package util;

public class IntPoint {

	protected int x;
	protected int y;
	
	public IntPoint(int x, int y){
		this.x=x;
		this.y=y;
	}
	
	public int getX(){
		return x;
	}
	public int getY(){
		return y;
	}
	
	public double distanceTo(IntPoint point){
		return Math.sqrt((x-point.getX())*(x-point.getX())+(y-point.getY())*(y-point.getY()));
	}
	
	public int distanceSquared(IntPoint point){
		return (x-point.getX())*(x-point.getX())+(y-point.getY())*(y-point.getY());
	}
	
	public void setX(int xs){
		x = xs;
	}
	
	public void setY(int ys){
		y = ys;
	}
	
	public void incX(int xs){
		x = x+xs;
	}
	
	public void incY(int ys){
		y = y+ys;
	}
	
	public String toString(){
		return "(" + x+ ", " + y +")";
	}
	
	public IntPoint clone() {
		return new IntPoint(x, y);
	}
	
	public void incDir(int direction, int speed) {
		y += Math.sin(Math.toRadians(direction))*speed;
		x += Math.cos(Math.toRadians(direction))*speed;
	}
}
